<%@page language="java" import="java.util.*" contentType="text/html; charset=utf-8"  pageEncoding="utf-8"%>
<%@page language="java" import="com.weixin.utils.WeixinUtil1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"+ request.getServletPath() + "?" + (request.getQueryString());
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head lang="en">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>分享二维码</title>
<link href="${pageContext.request.contextPath}/css/bootstrap.min.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/share_code.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/foot.css"
	rel="stylesheet">
</head>
<body>
	<%
	String basePath1 = request.getScheme()+"://"+request.getServerName()+""+path+request.getServletPath() + "?" + (request.getQueryString());
		Map<String,Object>  ret = new HashMap<String,Object> ();
	        ret=WeixinUtil1.getWxConfig(request,basePath1);
	        request.setAttribute("appId", ret.get("appId"));
	        System.out.println(ret.get("appId"));
	        request.setAttribute("timestamp", ret.get("timestamp"));
	        System.out.println(ret.get("timestamp"));
	        request.setAttribute("nonceStr", ret.get("nonceStr"));
	        System.out.println(ret.get("nonceStr"));
	        request.setAttribute("signature", ret.get("signature"));
	        System.out.println(ret.get("signature"));
	%>
	<!--头部-->
	<header class="box-header">
	

	<!-- 内容 -->
	<div class="All container">
		<div class="All_son">
			<div class="headportrait">
				<div class="headportrait_txate">
					<div class="headportrait_txate_img">
						<img src="<%=request.getParameter("headImage")%>">
						<input type="hidden" value="<%=request.getParameter("headImage")%>" id="touxiang">
					</div>
					<div class="headportrait_txate_text">
						<p class="headportrait_txate_text_one" style="color:#000">
								<%=request.getParameter("nickName")%>
							<img src="${pageContext.request.contextPath}/img/women_txmin.png">
						</p>
						<input type="hidden" value="<%=request.getParameter("nickName")%>" id="nickName">
						<input type="hidden" value="<%=request.getParameter("qrCode")%>" id="qrCode">
						<input type="hidden" value="<%=request.getParameter("city")%>" id="city">
						<input type="hidden" value="<%=request.getParameter("area")%>" id="area">
						<p class="headportrait_txate_text_two" style="font-size:8px;">
							<%=request.getParameter("city")%>&nbsp;&nbsp;&nbsp;&nbsp;<%=request.getParameter("area")%></p>
					</div>
				</div>
			</div>

			<!--</div>-->
			<!-- ================================================= -->
			<div class="code">
				<div class="code_img">
					<img src="${pageContext.request.contextPath}<%=request.getParameter("qrCode")%>">
					<%-- <div class="code_img_usertx">
                    <img src="${pageContext.request.contextPath}/img/usertx.png">
                </div> --%>
				</div>
			</div>
			<!-- ================================================= -->
			<div class="shibie_text">
				<p>长按识别二维码或直接扫描注册会员</p>
			</div>
			<!-- ================================================= -->
			<div class="fenxiang_text">
				<div class="fenxiang_text_son">
					<a href="#"> 点击右上角菜单分享给朋友 </a>
				</div>
			</div>

		</div>
	</div>

	<!--====================== 尾部 ======================-->
	<div class="container-fluid all_foot">
		<div class="row all_foot_nav">
			<%-- <div class="col-xs-3 all_foot_nav_navs">
				<a
					class="text-center help-block all_foot_nav_navs_block all_foot_nav_navs_block_true"
					href="${pageContext.request.contextPath}/UserAction_homepage?openId=${openId}">
					<div class="all_foot_nav_navs_block_icon">
						<img
							src="${pageContext.request.contextPath}/img/allIMG/index_true.png">
					</div>
					<p class="all_foot_nav_navs_block_title font13">首页</p>
				</a>
			</div>
			<div class="col-xs-3 all_foot_nav_navs">
				<a class="text-center help-block all_foot_nav_navs_block"
					href="${pageContext.request.contextPath}/TaskAction_getTaskAll?openId=${openId}">
					<div class="all_foot_nav_navs_block_icon">
						<img
							src="${pageContext.request.contextPath}/img/allIMG/renWu_f.png">
					</div>
					<p class="all_foot_nav_navs_block_title font13">任务</p>
				</a>
			</div>
			<div class="col-xs-3 all_foot_nav_navs">
				<a class="text-center help-block all_foot_nav_navs_block "
					href="${pageContext.request.contextPath}/TaskAction_queryMoneyOfUser?openId=${openId}">
					<div class="all_foot_nav_navs_block_icon">
						<img
							src="${pageContext.request.contextPath}/img/allIMG/money_f.png">
					</div>
					<p class="all_foot_nav_navs_block_title font13">钱包</p>
				</a>
			</div>
			<div class="col-xs-3 all_foot_nav_navs">
				<a class="text-center help-block all_foot_nav_navs_block "
					href="${pageContext.request.contextPath}/UserAction_myPersonal?openId=${openId}">
					<div class="all_foot_nav_navs_block_icon">
						<img
							src="${pageContext.request.contextPath}/img/allIMG/mine_f.png">
					</div>
					<p class="all_foot_nav_navs_block_title font13">我的</p>
				</a>
			</div> --%>
		</div>
	</div>
</body>
<script src="${pageContext.request.contextPath}/js/jquery-2.0.3.min.js"></script>
<script src="${pageContext.request.contextPath}/jsp/layer/layer.js"
	type="text/javascript"></script>
<script type="text/javascript"
	src="http://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
<script type="text/javascript">
	// 微信信息的以及调用的配置
	$(function(){
		/* alert(123); */
		var headImage=$("#touxiang").val();
		
    var link="http://wxad.vipshequ.com/FenXiao/pages/weixin/share_code.jsp?headImage="+headImage+"&nickName="+$("#nickName").val()+"&qrCode="+$("#qrCode").val()+"&city="+$("#city").val()+"&area="+$("#area").val();
	var imgUrl="http://wxad.vipshequ.com/FenXiao"+$("#qrCode").val();
	/* alert(imgUrl); */
	wx.config({
		debug : false,
		appId : 'wx9d49f59517209fb7',
		timestamp : ${timestamp},
		nonceStr : '${nonceStr}',
		signature : '${signature}',
		/*  alert($("#signature").val()), */
		jsApiList : ['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','onMenuShareQZone' ],
	});
	
	wx
			.ready(function() {
				// 获取“分享到朋友圈”按钮点击状态及自定义分享内容接口
				wx
						.onMenuShareTimeline({
							title : '扫描二维码关注社区微信公众号', // 分享标题
							link : link,
									
							imgUrl :imgUrl, // 分享图标
							success : function() {
								// 用户确认分享后执行的回调函数
								layer.msg("分享微信朋友圈成功！", {
									time : 3000,
									offset : 0,
									shift : 6
								});
							},
						});
				// 获取“分享给朋友”按钮点击状态及自定义分享内容接口
				wx
						.onMenuShareAppMessage({
							title : '扫描二维码关注社区微信公众号', // 分享标题
							desc : "扫描二维码关注社区微信公众号", // 分享描述
							link : link,
							imgUrl : imgUrl, // 分享图标
							type : 'link', // 分享类型,music、video或link，不填默认为link
						});

				//获取“分享到QQ”按钮点击状态及自定义分享内容接口
				wx
						.onMenuShareQQ({
							title : '扫描二维码关注社区微信公众号', // 分享标题
							desc : '扫描二维码关注社区微信公众号', // 分享描述
							link : link, // 分享链接
							imgUrl :imgUrl,// 分享图标
							success : function() {
								// 用户确认分享后执行的回调函数
								layer.msg("分享QQ朋友圈成功！", {
									time : 3000,
									offset : 0,
									shift : 6
								});
							},
						});

				//获取“分享到腾讯微博”按钮点击状态及自定义分享内容接口
				wx.onMenuShareWeibo({
							title : '扫描二维码关注社区微信公众号', // 分享标题
							desc : '扫描二维码关注社区微信公众号', // 分享描述
							link : link, // 分享链接
							imgUrl : imgUrl, // 分享图标
							success : function() {
								// 用户确认分享后执行的回调函数
								layer.msg("分享腾讯微博成功！", {
									time : 3000,
									offset : 0,
									shift : 6
								});
							},
						});

				//获取“分享到QQ空间”按钮点击状态及自定义分享内容接口
				wx.onMenuShareQZone({
							title : '扫描二维码关注社区微信公众号', // 分享标题
							desc : '扫描二维码关注社区微信公众号', // 分享描述
							link : link,// 分享链接
							imgUrl : imgUrl, // 分享图标
							success : function() {
								// 用户确认分享后执行的回调函数
								layer.msg("分享QQ空间成功！", {
									time : 3000,
									offset : 0,
									shift : 6
								});
							},
						});

			});

	wx.error(function(res) {
		// config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。
		alert(res.errMsg);
		
	});
	});
</script>
</html>
